<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
EventFilter (Commons Math 3.2 API)
</TITLE>


<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="EventFilter (Commons Math 3.2 API)";
    }
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">
<HR>


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/EventFilter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../../index.html?org/apache/commons/math3/ode/events/EventFilter.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="EventFilter.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.commons.math3.ode.events</FONT>
<BR>
Class EventFilter</H2>
<PRE>
<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
  <IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.commons.math3.ode.events.EventFilter</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events">EventHandler</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>EventFilter</B><DT>extends <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A><DT>implements <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events">EventHandler</A></DL>
</PRE>

<P>
Wrapper used to detect only increasing or decreasing events.

 <p>General <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events"><CODE>events</CODE></A> are defined implicitely
 by a <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html#g(double, double[])"><CODE>g function</CODE></A> crossing
 zero. This function needs to be continuous in the event neighborhood,
 and its sign must remain consistent between events. This implies that
 during an ODE integration, events triggered are alternately events
 for which the function increases from negative to positive values,
 and events for which the function decreases from positive to
 negative values.
 </p>

 <p>Sometimes, users are only interested in one type of event (say
 increasing events for example) and not in the other type. In these
 cases, looking precisely for all events location and triggering
 events that will later be ignored is a waste of computing time.</p>

 <p>Users can wrap a regular <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events"><CODE>event handler</CODE></A> in
 an instance of this class and provide this wrapping instance to
 the <A HREF="../../../../../../org/apache/commons/math3/ode/FirstOrderIntegrator.html" title="interface in org.apache.commons.math3.ode"><CODE>ODE solver</CODE></A>
 in order to avoid wasting time looking for uninteresting events.
 The wrapper will intercept the calls to the <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html#g(double, double[])"><CODE>g function</CODE></A> and to the <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html#eventOccurred(double, double[], boolean)"><CODE>eventOccurred</CODE></A> method in order to ignore uninteresting events. The
 wrapped regular <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events"><CODE>event handler</CODE></A> will the see only
 the interesting events, i.e. either only <code>increasing</code> events or
 <code>decreasing</code> events. the number of calls to the <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html#g(double, double[])"><CODE>g function</CODE></A> will also be reduced.</p>
<P>

<P>
<DL>
<DT><B>Since:</B></DT>
  <DD>3.2</DD>
<DT><B>Version:</B></DT>
  <DD>$Id: EventFilter.java 1458491 2013-03-19 20:13:11Z luc $</DD>
</DL>
<HR>

<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->

<A NAME="nested_class_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Nested Class Summary</B></FONT></TH>
</TR>
</TABLE>
&nbsp;<A NAME="nested_classes_inherited_from_class_org.apache.commons.math3.ode.events.EventHandler"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Nested classes/interfaces inherited from interface org.apache.commons.math3.ode.events.<A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events">EventHandler</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html" title="enum in org.apache.commons.math3.ode.events">EventHandler.Action</A></CODE></TD>
</TR>
</TABLE>
&nbsp;

<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventFilter.html#EventFilter(org.apache.commons.math3.ode.events.EventHandler, org.apache.commons.math3.ode.events.FilterType)">EventFilter</A></B>(<A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events">EventHandler</A>&nbsp;rawHandler,
            <A HREF="../../../../../../org/apache/commons/math3/ode/events/FilterType.html" title="enum in org.apache.commons.math3.ode.events">FilterType</A>&nbsp;filter)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wrap an <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events"><CODE>event handler</CODE></A>.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html" title="enum in org.apache.commons.math3.ode.events">EventHandler.Action</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventFilter.html#eventOccurred(double, double[], boolean)">eventOccurred</A></B>(double&nbsp;t,
              double[]&nbsp;y,
              boolean&nbsp;increasing)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Handle an event and choose what to do next.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventFilter.html#g(double, double[])">g</A></B>(double&nbsp;t,
  double[]&nbsp;y)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compute the value of the switching function.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventFilter.html#init(double, double[], double)">init</A></B>(double&nbsp;t0,
     double[]&nbsp;y0,
     double&nbsp;t)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Initialize event handler at the start of an ODE integration.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventFilter.html#resetState(double, double[])">resetState</A></B>(double&nbsp;t,
           double[]&nbsp;y)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reset the state prior to continue the integration.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="EventFilter(org.apache.commons.math3.ode.events.EventHandler, org.apache.commons.math3.ode.events.FilterType)"><!-- --></A><H3>
EventFilter</H3>
<PRE>
public <B>EventFilter</B>(<A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events">EventHandler</A>&nbsp;rawHandler,
                   <A HREF="../../../../../../org/apache/commons/math3/ode/events/FilterType.html" title="enum in org.apache.commons.math3.ode.events">FilterType</A>&nbsp;filter)</PRE>
<DL>
<DD>Wrap an <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events"><CODE>event handler</CODE></A>.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>rawHandler</CODE> - event handler to wrap<DD><CODE>filter</CODE> - filter to use</DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>

<A NAME="init(double, double[], double)"><!-- --></A><H3>
init</H3>
<PRE>
public void <B>init</B>(double&nbsp;t0,
                 double[]&nbsp;y0,
                 double&nbsp;t)</PRE>
<DL>
<DD>Initialize event handler at the start of an ODE integration.
 <p>
 This method is called once at the start of the integration. It
 may be used by the event handler to initialize some internal data
 if needed.
 </p>
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html#init(double, double[], double)">init</A></CODE> in interface <CODE><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events">EventHandler</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>t0</CODE> - start value of the independent <i>time</i> variable<DD><CODE>y0</CODE> - array containing the start value of the state vector<DD><CODE>t</CODE> - target time for the integration</DL>
</DD>
</DL>
<HR>

<A NAME="g(double, double[])"><!-- --></A><H3>
g</H3>
<PRE>
public double <B>g</B>(double&nbsp;t,
                double[]&nbsp;y)</PRE>
<DL>
<DD>Compute the value of the switching function.

 <p>The discrete events are generated when the sign of this
 switching function changes. The integrator will take care to change
 the stepsize in such a way these events occur exactly at step boundaries.
 The switching function must be continuous in its roots neighborhood
 (but not necessarily smooth), as the integrator will need to find its
 roots to locate precisely the events.</p>
 <p>Also note that the integrator expect that once an event has occurred,
 the sign of the switching function at the start of the next step (i.e.
 just after the event) is the opposite of the sign just before the event.
 This consistency between the steps <string>must</strong> be preserved,
 otherwise <A HREF="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception"><CODE>exceptions</CODE></A> related to root not being bracketed will occur.</p>
 <p>This need for consistency is sometimes tricky to achieve. A typical
 example is using an event to model a ball bouncing on the floor. The first
 idea to represent this would be to have <code>g(t) = h(t)</code> where h is the
 height above the floor at time <code>t</code>. When <code>g(t)</code> reaches 0, the
 ball is on the floor, so it should bounce and the typical way to do this is
 to reverse its vertical velocity. However, this would mean that before the
 event <code>g(t)</code> was decreasing from positive values to 0, and after the
 event <code>g(t)</code> would be increasing from 0 to positive values again.
 Consistency is broken here! The solution here is to have <code>g(t) = sign
 * h(t)</code>, where sign is a variable with initial value set to <code>+1</code>. Each
 time <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html#eventOccurred(double, double[], boolean)"><CODE>eventOccurred</CODE></A> is called,
 <code>sign</code> is reset to <code>-sign</code>. This allows the <code>g(t)</code>
 function to remain continuous (and even smooth) even across events, despite
 <code>h(t)</code> is not. Basically, the event is used to <em>fold</em> <code>h(t)</code>
 at bounce points, and <code>sign</code> is used to <em>unfold</em> it back, so the
 solvers sees a <code>g(t)</code> function which behaves smoothly even across events.</p>
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html#g(double, double[])">g</A></CODE> in interface <CODE><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events">EventHandler</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>t</CODE> - current value of the independent <i>time</i> variable<DD><CODE>y</CODE> - array containing the current value of the state vector
<DT><B>Returns:</B><DD>value of the g switching function</DL>
</DD>
</DL>
<HR>

<A NAME="eventOccurred(double, double[], boolean)"><!-- --></A><H3>
eventOccurred</H3>
<PRE>
public <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html" title="enum in org.apache.commons.math3.ode.events">EventHandler.Action</A> <B>eventOccurred</B>(double&nbsp;t,
                                         double[]&nbsp;y,
                                         boolean&nbsp;increasing)</PRE>
<DL>
<DD>Handle an event and choose what to do next.

 <p>This method is called when the integrator has accepted a step
 ending exactly on a sign change of the function, just <em>before</em>
 the step handler itself is called (see below for scheduling). It
 allows the user to update his internal data to acknowledge the fact
 the event has been handled (for example setting a flag in the <A HREF="../../../../../../org/apache/commons/math3/ode/FirstOrderDifferentialEquations.html" title="interface in org.apache.commons.math3.ode"><CODE>differential equations</CODE></A> to switch the derivatives computation in
 case of discontinuity), or to direct the integrator to either stop
 or continue integration, possibly with a reset state or derivatives.</p>

 <ul>
   <li>if <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html#STOP"><CODE>EventHandler.Action.STOP</CODE></A> is returned, the step handler will be called
   with the <code>isLast</code> flag of the <A HREF="../../../../../../org/apache/commons/math3/ode/sampling/StepHandler.html#handleStep(org.apache.commons.math3.ode.sampling.StepInterpolator, boolean)"><CODE>handleStep</CODE></A>
   method set to true and the integration will be stopped,</li>
   <li>if <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html#RESET_STATE"><CODE>EventHandler.Action.RESET_STATE</CODE></A> is returned, the <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html#resetState(double, double[])"><CODE>resetState</CODE></A> method will be called once the step handler has
   finished its task, and the integrator will also recompute the
   derivatives,</li>
   <li>if <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html#RESET_DERIVATIVES"><CODE>EventHandler.Action.RESET_DERIVATIVES</CODE></A> is returned, the integrator
   will recompute the derivatives,
   <li>if <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html#CONTINUE"><CODE>EventHandler.Action.CONTINUE</CODE></A> is returned, no specific action will
   be taken (apart from having called this method) and integration
   will continue.</li>
 </ul>

 <p>The scheduling between this method and the <A HREF="../../../../../../org/apache/commons/math3/ode/sampling/StepHandler.html" title="interface in org.apache.commons.math3.ode.sampling"><CODE>StepHandler</CODE></A> method <A HREF="../../../../../../org/apache/commons/math3/ode/sampling/StepHandler.html#handleStep(org.apache.commons.math3.ode.sampling.StepInterpolator, boolean)"><CODE>handleStep(interpolator, isLast)</CODE></A> is to call this method first and
 <code>handleStep</code> afterwards. This scheduling allows the integrator to
 pass <code>true</code> as the <code>isLast</code> parameter to the step
 handler to make it aware the step will be the last one if this method
 returns <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html#STOP"><CODE>EventHandler.Action.STOP</CODE></A>. As the interpolator may be used to navigate back
 throughout the last step (as <A HREF="../../../../../../org/apache/commons/math3/ode/sampling/StepNormalizer.html" title="class in org.apache.commons.math3.ode.sampling"><CODE>StepNormalizer</CODE></A>
 does for example), user code called by this method and user
 code called by step handlers may experience apparently out of order values
 of the independent time variable. As an example, if the same user object
 implements both this <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events"><CODE>EventHandler</CODE></A> interface and the
 <A HREF="../../../../../../org/apache/commons/math3/ode/sampling/FixedStepHandler.html" title="interface in org.apache.commons.math3.ode.sampling"><CODE>FixedStepHandler</CODE></A>
 interface, a <em>forward</em> integration may call its
 <code>eventOccurred</code> method with t = 10 first and call its
 <code>handleStep</code> method with t = 9 afterwards. Such out of order
 calls are limited to the size of the integration step for <A HREF="../../../../../../org/apache/commons/math3/ode/sampling/StepHandler.html" title="interface in org.apache.commons.math3.ode.sampling"><CODE>variable step handlers</CODE></A> and
 to the size of the fixed step for <A HREF="../../../../../../org/apache/commons/math3/ode/sampling/FixedStepHandler.html" title="interface in org.apache.commons.math3.ode.sampling"><CODE>fixed step handlers</CODE></A>.</p>
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html#eventOccurred(double, double[], boolean)">eventOccurred</A></CODE> in interface <CODE><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events">EventHandler</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>t</CODE> - current value of the independent <i>time</i> variable<DD><CODE>y</CODE> - array containing the current value of the state vector<DD><CODE>increasing</CODE> - if true, the value of the switching function increases
 when times increases around event (note that increase is measured with respect
 to physical time, not with respect to integration which may go backward in time)
<DT><B>Returns:</B><DD>indication of what the integrator should do next, this
 value must be one of <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html#STOP"><CODE>EventHandler.Action.STOP</CODE></A>, <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html#RESET_STATE"><CODE>EventHandler.Action.RESET_STATE</CODE></A>,
 <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html#RESET_DERIVATIVES"><CODE>EventHandler.Action.RESET_DERIVATIVES</CODE></A> or <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html#CONTINUE"><CODE>EventHandler.Action.CONTINUE</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="resetState(double, double[])"><!-- --></A><H3>
resetState</H3>
<PRE>
public void <B>resetState</B>(double&nbsp;t,
                       double[]&nbsp;y)</PRE>
<DL>
<DD>Reset the state prior to continue the integration.

 <p>This method is called after the step handler has returned and
 before the next step is started, but only when <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html#eventOccurred(double, double[], boolean)"><CODE>EventHandler.eventOccurred(double, double[], boolean)</CODE></A> has itself returned the <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html#RESET_STATE"><CODE>EventHandler.Action.RESET_STATE</CODE></A>
 indicator. It allows the user to reset the state vector for the
 next step, without perturbing the step handler of the finishing
 step. If the <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html#eventOccurred(double, double[], boolean)"><CODE>EventHandler.eventOccurred(double, double[], boolean)</CODE></A> never returns the <A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html#RESET_STATE"><CODE>EventHandler.Action.RESET_STATE</CODE></A> indicator, this function will never be called, and it is
 safe to leave its body empty.</p>
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html#resetState(double, double[])">resetState</A></CODE> in interface <CODE><A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events">EventHandler</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>t</CODE> - current value of the independent <i>time</i> variable<DD><CODE>y</CODE> - array containing the current value of the state vector
 the new state should be put in the same array</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/EventFilter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;PREV CLASS&nbsp;
&nbsp;<A HREF="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../../index.html?org/apache/commons/math3/ode/events/EventFilter.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="EventFilter.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
Copyright &#169; 2003-2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>
